using System;
using Microsoft.SPOT;
using dotnetwarrior.NetMF.DL40;

namespace DLIOTest
{
    class TestAnalogPin
    {
        static DLIOModule Module;
        static IAnalogInputPin AD1, AD2, AD3;

        public static void Run(DLIOModule module)
        {
            Module = module;

            AD1 = module.CreateAnalogInputPin(AnalogInputPinId.PIO1_2);
            AD2 = module.CreateAnalogInputPin(AnalogInputPinId.PIO1_10);
            AD3 = module.CreateAnalogInputPin(AnalogInputPinId.PIO1_11);

            Gadgeteer.Timer timer = new Gadgeteer.Timer(1000);
            timer.Tick += new Gadgeteer.Timer.TickEventHandler(timer_Tick);
            timer.Start();
        }

        static void timer_Tick(Gadgeteer.Timer timer)
        {
            uint value = AD1.ReadRaw();
            //uint value2 = AD2.ReadRaw();
            //uint value3 = AD3.ReadRaw();

            Debug.Print("V1: " + value);
            //Debug.Print("V2: " + value2);
            //Debug.Print("V3: " + value3);

            double proc1 = AD1.Read();
            //double proc2 = AD2.Read();
            //double proc3 = AD3.Read();

            Debug.Print("P1: " + proc1);
            //Debug.Print("P2: " + proc2);
            //Debug.Print("P3: " + proc3);
        }
    }
}
